<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/main.css" />
    <script type="text/javascript" src="../script/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/mobile.js"></script>
    <script type="text/javascript" src="../script/public.js"></script>
    <script type="text/javascript" src="../script/app.js"></script>
    <title>修改密码</title>
</head>
<body>
<header>
    <div class="zhifu_cgs">
        <div>
            <img src="../image/jiant_rg.png" alt="" onclick="open_winrs('wode','wode.html');">
            <p>修改密码</p>
        </div>
    </div>
</header>
<section>
    <div class="xioug_pwd">
        <ul>
            <li>
                <input name="password" type="password" placeholder="原密码">
            </li>
            <li>
                <input name="new_password" type="password" placeholder="新密码">
            </li>
            <li>
                <input name="t_password" type="password" placeholder="确认新密码">
            </li>
        </ul>
    </div>
    <div class="btn_xiumm">

        <input type="button" onclick="mima()" value="提交">
    </div>
</section>
</body>

<script type="text/javascript">
    window['adaptive'].desinWidth = 750;
    window['adaptive'].baseFont = 28;
    window['adaptive'].maxWidth = 750;
    window['adaptive'].init();

    apiready = function () {
        $api.fixStatusBar($api.dom('.header'));
        api.addEventListener({
            name: 'keyback'
        }, function(ret, err){
            api.closeWidget();
        });

    }

    //提交
    function mima(){
        var password = $('input[name=password]').val();
        var new_password = $('input[name=new_password]').val();
        var t_password = $('input[name=t_password]').val();
        if (password == '') {
            api.alert({msg:"请输入原密码"});return;
        }else if (new_password == '') {
            api.alert({msg:"请输入新密码"});return;
        }else if(t_password == ''){
            api.alert({msg:"再次确认新密码"});return;
        }
        var p = {uid:id,password:password,new_password:new_password,t_password:t_password};
        api.ajax({
            url:webSiteUrl+'/App/User/edit_pwd',
            method:'post',
            data:{
                values:p
            }
        },function(ret,err){
            if (ret.code == 200) {

                alert(ret.msg);
                alert(JSON.stringify("请重新登录！"));
                api.openWin({
                    name: 'loginName',
                    url: './login.html',
                    pageParam: {
                        name: 'text'
                    }
                });
            }else{
                alert(ret.msg);
            }
        });
    }
</script>
</html>